﻿CREATE PROCEDURE [dbo].[Forum_ThreadNote_Get]
	@threadNoteId BIGINT
AS
BEGIN
	DECLARE @threadId BIGINT

	SELECT @threadId = [ThreadId]
	FROM [dbo].[forum_ThreadNote]

	IF @threadId IS NULL
		RETURN

	SELECT t.[ThreadId]
				,t.[Name] AS 'Title'
				,s.[HashTag] AS 'SectionHashTag'
				,tn.[ThreadNoteId]
				,tn.[Text]
	FROM [dbo].[forum_ThreadNote] AS tn
	INNER JOIN [dbo].[forum_Thread] AS t ON tn.[ThreadId] = t.[ThreadId]
	INNER JOIN [dbo].[forum_Section] AS s ON t.[SectionId] = s.[SectionId]
	WHERE tn.[ThreadNoteId] = @threadNoteId



END